<template>
  <el-dialog v-model="visible" :title="'详情'" :close-on-click-modal="false" :close-on-press-escape="false">
    <el-form :model="dataForm" :rules="rules" ref="dataFormRef" @keyup.enter="dataFormSubmitHandle()" label-width="120px" disabled="true">
          <el-form-item label="业务ID" prop="businessId">
        <el-input v-model="dataForm.businessId" placeholder=""></el-input>
      </el-form-item>
          <el-form-item label="业务表名" prop="tableName">
        <el-input v-model="dataForm.tableName" placeholder=""></el-input>
      </el-form-item>
          <el-form-item label="原始文件名称" prop="fileName">
        <el-input v-model="dataForm.fileName" placeholder=""></el-input>
      </el-form-item>
          <el-form-item label="附件存储名称" prop="fileSaveName">
        <el-input v-model="dataForm.fileSaveName" placeholder=""></el-input>
      </el-form-item>
          <el-form-item label="文件类型" prop="fileSuffix">
        <el-input v-model="dataForm.fileSuffix" placeholder=""></el-input>
      </el-form-item>
          <el-form-item label="附件的大小" prop="fileSize">
        <el-input v-model="dataForm.fileSize" placeholder=""></el-input>
      </el-form-item>
          <el-form-item label="附件存储地址" prop="url">
        <el-input v-model="dataForm.url" placeholder=""></el-input>
      </el-form-item>
          <el-form-item label="附件的类型" prop="type">
            <ren-radio-group v-model="dataForm.type" dict-type="attment_type"></ren-radio-group>
<!--        <el-input v-model="dataForm.type" placeholder="附件的类型标识"></el-input>-->
      </el-form-item>
          <el-form-item label="附件的状态" prop="status">
            <ren-radio-group v-model="dataForm.status" dict-type="attment_status"></ren-radio-group>
<!--        <el-input v-model="dataForm.status" placeholder="附件的状态"></el-input>-->
      </el-form-item>
          <el-form-item label="备注说明" prop="remark">
        <el-input v-model="dataForm.remark" placeholder=""></el-input>
      </el-form-item>
          <el-form-item label="项目创建人" prop="createUser">
        <el-input v-model="dataForm.createUser" placeholder=""></el-input>
      </el-form-item>
          <el-form-item label="项目创建时间" prop="createTime">
        <el-input v-model="dataForm.createTime" placeholder=""></el-input>
      </el-form-item>
          <el-form-item label="最后更新人" prop="updateUser">
        <el-input v-model="dataForm.updateUser" placeholder=""></el-input>
      </el-form-item>
          <el-form-item label="最后更新时间" prop="updateTime">
        <el-input v-model="dataForm.updateTime" placeholder=""></el-input>
      </el-form-item>
      </el-form>
  </el-dialog>
</template>

<script lang="ts" setup>
import { reactive, ref } from "vue";
import baseService from "@/service/baseService";
import { ElMessage } from "element-plus";
const emit = defineEmits(["refreshDataList"]);

const visible = ref(false);
const dataFormRef = ref();

const dataForm = reactive({
  attachmentId: '',  businessId: '',  tableName: '',  fileName: '',  fileSaveName: '',  fileSuffix: '',  fileSize: '',  url: '',  type: '',  status: '',  remark: '',  createUser: '',  createTime: '',  updateUser: '',  updateTime: ''});

const init = (attachmentId?: number) => {
  visible.value = true;
  dataForm.attachmentId = "";

  if (attachmentId) {
    getInfo(attachmentId);
  }
};

// 获取信息
const getInfo = (attachmentId: number) => {
  baseService.get("/attachment/attachment/" + attachmentId).then((res) => {
    Object.assign(dataForm, res.data);
  });
};

defineExpose({
  init
});
</script>
